package com.example.vo.res;

import com.example.constants.ErrorCodeEnum;
import com.example.handler.BusinessErrorException;

public class ErrorJsonResult {

    /**
     * 异常码
     */
    private String code;

    /**
     * 异常信息
     */
    private String msg;

    public ErrorJsonResult(ErrorCodeEnum code) {
        this.code = code.code();
        this.msg = code.msg();
    }

    public ErrorJsonResult(BusinessErrorException ex) {
        this.code = ex.getCode();
        this.msg = ex.getMessage();
    }

    public ErrorJsonResult(ErrorCodeEnum code, String msg) {
        this.code = code.code();
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

}
